package com.yu.service;

import java.util.Vector;

import com.alibaba.fastjson.JSON;
import com.yu.dao.TuserDao;
import com.yu.pojo.Tuser;

public class TuserService {
	TuserDao ud = new TuserDao();
	
	public String login(String uname, String upwd) {
		DL dl = DL.getdl();
		Vector<Tuser> users = dl.getUsers();
		Tuser user = null;
		for(int i = 0; i<users.size();i++) {
			if(users.get(i).getUname().equals(uname)&&users.get(i).getUpwd().equals(upwd)) {
				user = users.get(i);
			}
		}
//		Tuser u = ud.login(uname, upwd);
		if(user==null) {
			return "{\"msg\":\"error\"}";
		} else {
			return JSON.toJSONString(user);
		}
	}
	
}
